package com.mycompany.myapp;

import android.app.*;
import android.content.*;
import android.os.*;
import com.a.*;
import java.io.*;

public class MainActivity extends Activity 
{
	//声明
	Context context = MainActivity.this;
	Activity act = MainActivity.this;
	
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
		
		goapk();    
    }

	private void goapk()
	{
		//根目录
		String a = "/sdcard/";
		//把压缩包解压到sd卡
		//声明库
		d m = new d();
		//解压到根目录app压缩包
		m.a(a + "app.zip", context, "app");
		try
		{
			//解压压缩包文件
			b.upZipFile(new File(a + "app.zip"), a + "app");
		}
		catch (IOException e)
		{}
		//写入内容，我的标题....,我是网址
		m.sendtext("标题"+"我的内容"+"标题"+"链接"+"http://baidu.com"+"链接", a + "app/assets/app");
		try
		{
			//压缩文件夹至APK
			m.zip(a + "app", a + "a.apk");
			//删除文件夹
			m.deleteDirectory(a + "app");
			//删除压缩包
			m.deleteSingleFile(a + "app.zip");
			//签名
			if (c.sign(a + "a.apk", "mnt/sdcard/sign.apk"))
			{
				//打开安装包
				m.b(context, "mnt/sdcard/sign.apk");
				m.toast("正在打开...",act);
			}
			//签名失败
			else
			{
				m.toast("失败！",act);
			}
		}
		catch (Exception e)
		{}
		
	}
}
